home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / ARexxTools / dme_rexxmacs.lha / dmake.dme next >
Encoding:
Text File  |  1992-04-29  |  3.6 KB  |  126 lines

  1. /**********************************************************************/
  2. /*        LCompile V1.1, Written by, Paul D. Cardwell 1992          */
  3. /*        Adapted to dme by Thomas J. Moore 1992              */
  4. /*   This program is to either "make" or "compile" DICE C  .C files   */
  5. /**********************************************************************/
  6.  
  7. Options Results
  8.  
  9. if ~show(l,'rexxsupport.library') then
  10.     call addlib('rexxsupport.library',0,-30,0)
  11.  
  12. parse arg filename
  13.  
  14. dme_addr = address()
  15. getval '$rexxport'
  16. if result ~= dme_addr then exit 20 /* not correct dme */
  17.  
  18. options failat 100
  19. address command "delete >nil: T:dcc.output"
  20. options failat 5
  21.  
  22. if filename = "" then do
  23.     getval '$fname'
  24.     file_name = result
  25. end
  26. getval '$fpath'
  27. currpath = result
  28. makefil = ""
  29. flag = 0
  30. CTRLJ = '0A'X
  31.  
  32. address value dme_addr
  33.  
  34. if exists(currpath'makefile') | exists(currpath'dmakefile') then file_name = ""
  35. if upper(file_name) = "DMAKEFILE" then file_name = ""
  36. if upper(file_name) = "MAKEFILE" then file_name = ""
  37. if right(upper(file_name),4) = ".LMK" then
  38.   do
  39.     makefil = file_name
  40.     file_name = ""
  41.   end
  42.  
  43. if file_name = "" then filename = "dmake"
  44. else
  45.   do
  46.     if right(upper(file_name),2) ~= ".C" then
  47.       do
  48.        title "(I need a .c file not" file_name
  49.        exit 0
  50.       end
  51.     else
  52.       do
  53.     getval '$filename'
  54.     filename = result
  55.       end
  56.   end
  57.  
  58. getval '$modified'
  59. if result ~= 0 then 'saveold'
  60.  
  61. if filename ~= "dmake" then
  62.   do
  63.    flag = 1
  64.    xx = strip(file_name,'B','.c')
  65. /* String = "dcc > T:dcc.output -2.0 "||filename||" -o ram:"||xx */
  66.    "set compopt RESULT"
  67.    String = "dcc >>T:dcc.output -ET:dcc.output "||filename||" -o ram:"||xx
  68.    "title (Set Compile/Link options) escimm (set compopt ("String")) null"
  69.    "getval $compopt"
  70.    String = result
  71.    if String = "RESULT" then Call Quit_Die
  72.    title "(Compiling and Linking " filename "... please wait)"
  73. /* rawkey 68 1 */
  74.    curdir = pragma(directory)
  75. /* TheCommand = "Path DCC:bin add" || CTRLJ */
  76.    TheCommand = /* TheCommand || */ "CD " || d2c(34) || currpath || d2c(34) || CTRLJ
  77.    TheCommand = TheCommand || String || CTRLJ
  78.    TheCommand = TheCommand || " CD " || d2c(34) || curdir || d2c(34)
  79.    Address command TheCommand
  80.   end
  81. else       /* else use makefile */
  82.   do
  83.    flag = 1
  84.    if makefil = "" then String = "BMAKE >con:0/24/640/150/Make/AUTO/WAIT"
  85.    else String = "BMAKE >con:0/24/640/150/Make/AUTO/WAIT -f "||makefil
  86.    "set compopt RESULT"
  87.    "title (Set Make Options) escimm (set compopt ("String")) null"
  88.    "getval $compopt"
  89.    String = result
  90.    if String = "RESULT" then Call Quit_Die
  91.    "title (Running makefile...)"
  92. /* rawkey 68 1 */
  93.    curdir = pragma(directory)
  94.    TheCommand = "SetEnv DCCOPTS -ET:dcc.output" || CTRLJ /* should really append this to dccopts */
  95. /* TheCommand = TheCommand || "Path DCC:bin add" || CTRLJ */
  96.    TheCommand = TheCommand || "CD " || d2c(34) || currpath || d2c(34) || CTRLJ
  97.    TheCommand = TheCommand || String || CTRLJ
  98.    TheCommand = TheCommand || "UnSetEnv DCCOPTS" || CTRLJ
  99.    TheCommand = TheCommand || " CD " || d2c(34) || curdir || d2c(34)
  100.    Address command TheCommand
  101.   end
  102.  
  103.  
  104. if flag = 1 then do
  105.     flst = statef('T:dcc.output')
  106.     parse value flst with entrytype size other
  107.     if size > 0 then do
  108.     "ping 1 findfile (*Compiler Errors*)"
  109.     "getval ($filename)"
  110.     if result ~= '*Compiler Errors*' then
  111.         "openwindow +0-100-0+100 chfilename (*Compiler Errors*) insfile T:dcc.output modified off pong 1"
  112.     else
  113.         "findfile (*Compiler Errors*) newfile T:dcc.output chfilename (*Compiler Errors*) modified off pong 1"
  114.     "title (dmake completed; errors detected)"
  115.     end
  116.     else
  117.     "title (dmake completed)"
  118. end
  119.  
  120. Quit_Die:
  121. exit 0
  122.  
  123. Quit_Die : procedure
  124. title (dmake aborted)
  125. exit 0
  126.